<?php if (!empty($messages)) {?>
<form method="post" action="/user/message_delete">
<table class="a_table text_left_table" width="100%" cellspacing="0">
	<?php foreach($messages as $message) { ?>
	<tr>
		<td width="24"><input type="checkbox" name="msg_id[]" value="<?php echo $message['id']?>"/></td>
		<td width="100" class="<?php echo $message['checked'] ? "grey" : "bold"?>"><?php echo $message['msg_from']?></td>
		<td class="<?php echo $message['checked'] ? "grey" : "bold"?>"><a href="/user/message_view/<?php echo $message['id'];?>"><?php echo $message['subject'];?></a></td>
		<td width="95"><?php echo substr($message['created'], 0, 10);?></td>
	</tr>
	<?php } ?>
	
	<tr class="table_top_border">
		<td><input type="checkbox" id="check-all"/></td>
		<td>全选</td>
		<td></td>
		<td><?php $this->load->view("common/page_controller");?></td>
	</tr>
	
	<tr>
		<td></td>
		<td colspan="3"><input type="submit" class="button" value="删除"/></td>
	</tr>
</table>
</form>
<?php }?>
<script type="text/javascript">
$(document).ready(function(){
	$("#check-all").click(function() {
		$("input[name='msg_id[]']").attr("checked", true);
	});
});
</script>